package com.cy.demo.controller;

import com.cy.demo.pojo.Address;
import com.cy.demo.pojo.District;
import com.cy.demo.service.IAddressService;
import com.cy.demo.service.IDistrictService;
import com.cy.demo.utils.jsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@RequestMapping("districts")
@RestController
public class DistrictController extends BaseController{

    @Autowired
    private IDistrictService DistrictService;

    @RequestMapping({"/",""})
    public jsonResult<List<District>> queryProvinces(String parent){
        List<District> districtList = DistrictService.findByParent(parent);
        return new jsonResult<>(districtList,OK);
    }
}
